﻿using Md.Demo.Service;
using System;
using System.Text.Json;
using System.Threading.Tasks;
using static Md.Demo.Service.Greeter;
using static Md.Demo.Service.Interview;

namespace Md.Demo.Rpc
{
    public class InterviewRpc
    {
        private readonly InterviewClient _interviewClient;
        public InterviewRpc(InterviewClient interviewClient)
        {
            _interviewClient = interviewClient;
        }
        public async Task<JsonElement> GetDepatmentListAsync(GetListRequest postData)
        {
            var res = await _interviewClient.GetDepatmentListAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> GetInterviewerListAsync(GetListRequest postData)
        {
            var res = await _interviewClient.GetinterviewerListAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> GetJobListAsync(JobListRequest postData)
        {
            var res = await _interviewClient.GetJobListAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> CreateJobAsync(CreateJobRequest postData)
        {
            var res = await _interviewClient.CreateJobAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> DeleteJobAsync(DeleteRequest postData)
        {
            var res = await _interviewClient.DeleteJobAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> GetStaffListAsync(StaffListRequest postData)
        {
            var res = await _interviewClient.GetStaffListAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> CreateStaffAsync(CreateStaffRequest postData)
        {
            var res = await _interviewClient.CreateStaffAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> DeleteStaffAsync(DeleteRequest postData)
        {
            var res = await _interviewClient.DeleteStaffAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> GetInterviewListAsync(InterviewListRequest postData)
        {
            var res = await _interviewClient.GetInterviewListAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> CreateInterview(CreateInterviewRequest postData)
        {
            var res = await _interviewClient.CreateInterviewAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
        public async Task<JsonElement> DeleteInterviewAsync(DeleteRequest postData)
        {
            var res = await _interviewClient.DeleteInterviewAsync(postData);
            var document = JsonDocument.Parse(res.ToString());
            return document.RootElement;
        }
    }
}
